// pinia可视化大屏
import express from "express";
import axios from "axios";
const app = express()
// 解决跨域问题
app.use("*",(req,res,next)=>{
    res.header('Access-Control-Allow-Origin',"*")
    next()
})
// 定义路由，后续在router上面定义请求都会携带api
const router = express.Router()
app.use('/api', router)

// 人口数据接口
router.get('/personlist', async (req, res) => {
    let result = await axios.get("http://127.0.0.1:4523/m1/3739922-0-default/getperosn")
    // 将相应对象作为json格式发送给客户端
    res.json({
        data: result.data
    })
})

app.listen(3333,()=>{
    console.log('server listen')
})
